package com.zmht.beike.dao.impl;

import java.io.Serializable;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;

import com.zmht.beike.core.BaseDAOImpl;
import com.zmht.beike.dao.IWeekinfoDAO;
import com.zmht.beike.po.TIweekinfo;
/**
 * 个别周主题 基本信息表
 * @author Administrator
 *
 */
public class IWeekinfoDAOImpl extends BaseDAOImpl implements IWeekinfoDAO {

	public TIweekinfo findByTarget(String targetId, String month,
			String week,Integer teacherId) {
		Session session = this.getSession();
		Criteria c = session.createCriteria(TIweekinfo.class);
		
		c.add(Restrictions.eq("week", new Integer(week)));
		c.add(Restrictions.eq("iaimId", new Integer(targetId)));
		c.add(Restrictions.eq("teacherId", teacherId+""));
		c.createCriteria("imonthinfo", "m").add(Restrictions.eq("m.monthType",new Integer(month)));
		List ls = c.list();
		
		if(ls!=null&&ls.size()>0){
			return (TIweekinfo)ls.get(0);
		}
		return null;
	}

}
